<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0" />
    <title>美策平台</title>
    <link rel="icon" type="image/png" href="/img/icon.png">
    <link rel="stylesheet" type="text/css" href="../datepicker/jquery-ui.min.css">
    <link type="text/css" rel="stylesheet" href="../css/app.css"/>
    <link type="text/css" rel="stylesheet" href="../css/loginMobile.css"/>
    <script type="text/javascript" src="../js/jquery.min.js"></script>
    <script src="../datepicker/jquery-ui.min.js"></script>
    <script type="text/javascript" src="/pc/js/all.js"></script>
</head>
<body id="Ibody">
<!--
	制作：陈道祥
	页面：员工基本信息
	更新：九哥
-->





<!-----------公司员工信息1页面---------->
<div class="stepTwo" id="IstepFiveCompanyEmployeeInfoOne">
    <div class="companyHeadPanel">
        <div class="companyHeadOne" style="color:red;">*标识为必填项</div>
    </div>
    <div class="companyInfoSpace"></div>
    <div class="modelPanel">
        <div class="modelTile">基本信息 <span style="color:red;">*</span></div>
        <div class="bossInfoDiv">
            <span style="color:red;">*</span>
            <input type="text" placeholder="请输入姓名" class="regCode staffInfoChange"
                   id="staffName" data-class="staffName" value="" onkeyup="staffInfoChange()">
        </div>
        <div class="bossInfoDiv">
            <span style="color:red;">*</span>
            <input type="text" placeholder="点击选择性别" class="regCode staffInfoChange"
                   readonly id="staffSexName" data-class="staffSexName">
            <input type="hidden" id="staffSex" data-class="staffSex" class="staffInfoChange staffInfoChangeTwo" value="0" onchange="staffInfoChange()">
        </div>
        <div class="bossInfoDiv">
            <span style="color:red;">*</span>
            <input type="text" placeholder="请选择出生日期" class="regCode staffInfoChange"
                   readonly id="staffBirthName" data-class="staffBirthName" value="">
            <input type="hidden" id="staffBirth" data-class="staffBirth" class="staffInfoChange staffInfoChangeTwo" value="0" onchange="staffInfoChange()">
        </div>
        <div class="bossInfoDiv">
            <span style="color:red;">*</span>
            <input type="text" placeholder="请输入最高学历" class="regCode staffInfoChange"
                   readonly id="staffEduName" data-class="staffEduName" value="">
            <input type="hidden" id="staffEdu" data-class="staffEdu" class="staffInfoChange staffInfoChangeTwo" value="0" onchange="staffInfoChange()">
        </div>
        <div class="bossInfoDiv">
            <span style="color:red;">*</span>
            <input type="text" placeholder="请输入体重（公斤）" class="regCode staffInfoChange"
                   id="staffWeight" data-class="staffWeight" value="" onkeyup="staffInfoChange()">
        </div>
        <div class="bossInfoDiv">
            <span style="color:red;">*</span>
            <input type="text" placeholder="请输入政治面貌" class="regCode staffInfoChange"
                   readonly id="staffPolityName" data-class="staffPolityName" value="">
            <input type="hidden" id="staffPolity" data-class="staffPolity" class="staffInfoChange staffInfoChangeTwo" value="0" onchange="staffInfoChange()">
        </div>
        <div class="bossInfoDiv">
            <span style="color:red;">*</span>
            <input type="text" placeholder="请输入籍贯" class="regCode staffInfoChange"
                   id="staffOrigin" data-class="staffOrigin" value="" onkeyup="staffInfoChange()">
        </div>
        <div class="bossInfoDiv">
            <span style="color:red;">*</span>
            <input type="text" placeholder="请输入民族" class="regCode staffInfoChange"
                   id="staffNation" data-class="staffNation" value="" onkeyup="staffInfoChange()">
        </div>
        <div class="bossInfoDiv">
            <span style="color:red;">*</span>
            <input type="text" placeholder="请输选择婚姻状态" class="regCode staffInfoChange"
                   id="staffMarryName" data-class="staffMarryName" value="">
            <input type="hidden" id="staffMarry" data-class="staffMarry" class="staffInfoChange staffInfoChangeTwo" value="0" onchange="staffInfoChange()">
        </div>
        <div class="bossInfoDiv">
            <span style="color:red;">*</span>
            <input type="text" placeholder="请输入身份证号码" class="regCode staffInfoChange"
                   id="idCard" data-class="idCard" value="" onkeyup="staffInfoChange()">
        </div>
        <div class="bossInfoDiv">
            <span style="color:red;">*</span>
            <input type="text" placeholder="请输入住宿情况" class="regCode staffInfoChange"
                   id="staffHouse" data-class="staffHouse" value="" onkeyup="staffInfoChange()">
        </div>
        <div class="bossFileDiv" id="staffImages">
            <div class="bossFileText">
                <span style="color:red;">*</span>
                请上传形象照片</div>
            <input type="file" class="bossFile" id="bossFile"
                   onchange="$('#submit').show(),staffInfoChange()">
            <button type="button" class="bossFileUp" id="submit">上传</button>
            <div class="bossFileImgDiv" id="staffImg" style="display:none;">
                <input type="hidden" id="staffXxzUrl" value=""/>
            </div>
        </div>
        <div class="bossInfoDiv">
            <span style="color:red;">*</span>
            <input type="text" placeholder="请输入户口地址" class="regCode staffInfoChange"
                   id="houseAddress" data-class="houseAddress" value="" onkeyup="staffInfoChange()">
        </div>
        <div class="bossInfoDiv">
            <span style="color:red;">*</span>
            <input type="text" placeholder="请输入现住地址" class="regCode staffInfoChange"
                   id="liveAddress" data-class="liveAddress" value="" onkeyup="staffInfoChange()">
        </div>
        <div class="bossInfoDiv">
            <span style="color:red;">*</span>
            <input type="text" placeholder="请输入紧急联系人" class="regCode staffInfoChange"
                   id="contactPerson" data-class="contactPerson" value="" onkeyup="staffInfoChange()">
        </div>
        <div class="bossInfoDiv">
            <span style="color:red;">*</span>
            <input type="text" placeholder="请输入紧急电话" class="regCode staffInfoChange"
                   id="contactMobile" data-class="contactMobile" value="" onkeyup="staffInfoChange()">
        </div>
        <div class="bossInfoDiv">
            <span style="color:red;">*</span>
            <input type="text" placeholder="请输入期望月薪" class="regCode staffInfoChange"
                   id="salary" data-class="salary" value="" onkeyup="staffInfoChange()">
        </div>
    </div>
    <div class="companyInfoSpace"></div>
    <div class="modelPanel">
        <div class="businessTitle">专业技能(多选)： <span style="color:red;">*</span></div>
        <div class="businessItemDiv" id="skillCheck">
        </div>
        <div class="businessTitle">特长爱好(多选)： <span style="color:red;">*</span></div>
        <div class="businessItemDiv" id="hobbyCheck">
        </div>
        <!--技能ID拼接、爱好ID拼接-->
        <input type="hidden" id="skillStr" value="">
        <input type="hidden" id="hobbyStr" value="">
    </div>
    <div class="stopFloat"></div>
    <div class="companyInfoSpace"></div>
    <div class="companyRemark">备注：方便你的客户找到你、招聘的员工找到你、了解你、信任你，图片尽量上传完善。让客户多了解自己，容易接单成功。细节决定成败，图片清晰。</div>
    <div class="nextStepDiv">
        <span class="prevStep" onclick="history.go(-1)">返回</span>
        <!--<span class="nextStep" id="staffInfo1Next">下一步</span>-->
        <span class="nextStep" onclick="setSave()">保存</span>
    </div>
</div>
<!-----------公司员工信息1页面---------->





<!-----------提示信息---------->
<div id="pop">
    <div id="popMask"></div>
    <div id="popDetail">
    </div>
</div>
<!-----------提示信息---------->

<!-----------提示信息---------->
<div id="errMsg"></div>
<!-----------提示信息---------->
</body>
<script type="text/javascript" src="../js/app.js"></script>
<script type="text/javascript" src="../js/staffInfoChange.js"></script>
<script type="text/javascript" src="../js/loginStaff.js"></script>
<script src="../js/imgUpload.js"></script>
<script>
    (function(){
        getStaffInfo();
    })();
    imgUpload('bossFile', 'submit', '/api/member/upload/img', function(e) {
        console.log(e);
        if (e.code!=0) {
            getAppErrMsg('图片尺寸过大，或服务器错误！','',0);return;
        }
        var h = '';
        h += '<img src="'+e.data.img+'" height="100" class="bossFileImgDelete"/>';
        h += '<input type="hidden" id="staffXxzUrl" value="'+e.data.img+'"/>';
        $('#staffImg').html(h).height(100).show();
        $('#bossFile')[0].value = '';
        $('#submit').hide();
        staffInfoChange() // 星号改变及数据缓存
    });
    /**
     * 保存设置
     * */
    function setSave(){
        var userInfo = cacheGet('userInfo'); //获取用户信息
        var staffInfo = cacheGet('staffInfo'); //获取用户资料1
        if (userInfo==null || userInfo.token=='undefined') {
            getErrMsg('没有登录！'); return;
        }
        if (staffInfo=='undefined') {
            getErrMsg('没有选择职位！'); return;
        }
        //获取表单
        var staffName = $('#staffName').val();
        var staffSex = $('#staffSex').val();
        var staffBirth = $('#staffBirth').val();
        var staffEdu = $('#staffEdu').val();
        var staffWeight = $('#staffWeight').val();
        var staffPolity = $('#staffPolity').val();
        var staffOrigin = $('#staffOrigin').val();
        var staffNation = $('#staffNation').val();
        var staffMarry = $('#staffMarry').val();
        var idcard = $('#idCard').val();
        var staffHouse = $('#staffHouse').val();
        var staffXxzUrl = $('#staffXxzUrl').val();
        var houseAddress = $('#houseAddress').val();
        var liveAddress = $('#liveAddress').val();
        var contactPerson = $('#contactPerson').val();
        var contactMobile = $('#contactMobile').val();
        var salary = $('#salary').val();
        var skillStr = $("#skillStr").val();
        var hobbyStr = $("#hobbyStr").val();
        if (staffName=='') { getErrMsg('姓名未填写！'); return; }
        if (staffSex==0) { getErrMsg('性别未选择！'); return; }
        if (staffBirth=='') { getErrMsg('出生未填写！'); return; }
        if (staffEdu==0) { getErrMsg('学历未填选！'); return; }
        if (staffWeight=='') { getErrMsg('体重未填写！'); return; }
        if (staffPolity==0) { getErrMsg('政治面貌未填选！'); return; }
        if (staffOrigin=='') { getErrMsg('籍贯未填写！'); return; }
        if (staffNation=='') { getErrMsg('民族未填写！'); return; }
        if (staffMarry==0) { getErrMsg('婚姻貌未填选！'); return; }
        if (idcard=='') { getErrMsg('身份证号码未填写！'); return; }
        if (staffHouse=='') { getErrMsg('住宿未填写！'); return; }
        if (!staffXxzUrl || staffXxzUrl=='') { getErrMsg('形象照未上传！'); return; }
        if (houseAddress=='') { getErrMsg('户口地址未填写！'); return; }
        if (liveAddress=='') { getErrMsg('现住地址未填写！'); return; }
        if (contactPerson=='') { getErrMsg('紧急联系人未填写！'); return; }
        if (contactMobile=='') { getErrMsg('紧急电话未填写！'); return; }
        if (salary=='') { getErrMsg('期望薪资未填写！'); return; }
        if (skillStr=='') { getErrMsg('技能未填选！'); return; }
        if (hobbyStr=='') { getErrMsg('爱好未填选！'); return; }
        var info = {
            jobType:staffInfo.jobType,
            realname:staffName,
            sex:staffSex,
            birth:staffBirth,
            edu:staffEdu,
            weight:staffWeight,
            polity:staffPolity,
            origin:staffOrigin,
            nation:staffNation,
            marry:staffMarry,
            idcard:idcard,
            house:staffHouse,
            xxz:staffXxzUrl,
            address:houseAddress,
            live:liveAddress,
            person:contactPerson,
            mobile:contactMobile,
            salary:salary,
            skillStr:skillStr,
            hobbyStr:hobbyStr
        };
        var data = {
            app_access:app_access,
            token:userInfo.token,
            type:userInfo.type,
            cate:userInfo.cate,
            staffInfos:info
        };
        cacheSet('staffInfo',''); // 清除缓存个人信息
        $.ajax({
            type:'post',
            url:getDomain() + 'staff/modify',
            data:data,
            success:function(res){
                //console.log(res); return;
                if (res.code!=0) {
                    getErrMsg(res.msg); return;
                }
                window.location.href = '/h5/login/staffList.html';
            },
            error:function(){
                getErrMsg('操作失败！'); return;
            }
        });
    }
</script>
</html>